/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package objects;

import graphic.Graphic;
import graphic.TextureBase;
import org.lwjgl.opengl.GL11;
import org.newdawn.slick.opengl.Texture;

/**
 *
 * @author nicra
 */
public class LoadingAnim {
    public static Texture txt;
    public float degree;
    public int timerID;
    public int time;
    
    public SRect rect=new SRect();
    float x,y;
    
    public LoadingAnim(int t, float x, float y, float size){
        time =t;
        timerID=TimeManager.register(t);
        float sh=size/2;
        rect.x1=-sh;
        rect.x2=+sh;
        rect.y1=sh;
        rect.y2=-sh;
        
        this.x=x;this.y=y;
    }
    
    public void draw(){
        
        float deg=(float)(System.currentTimeMillis()%1000)/1000f*360f;
        GL11.glTranslatef(x, y, 0);
        GL11.glRotatef(-deg, 0, 0, 1);
        Graphic.e.drawSprite(rect, txt);
        GL11.glRotatef(deg, 0, 0, 1); 
        GL11.glTranslatef(-x, -y, 0);
        
    }
    
    public static void init(){
        txt=TextureBase.get("images/load.png");
    }
}
